package team.seekers.hula.user.school.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.common.entity.PageResult;
import team.seekers.hula.user.school.entity.dto.SchoolQueryDTO;
import team.seekers.hula.user.school.entity.vo.SchoolListVO;
import team.seekers.hula.user.school.service.SchoolService;

/**
 * 一个学校 前端控制器
 * @author hbc
 */
@Controller
@ApiResponseBody
@RequestMapping("/school")
public class SchoolController {

    @Autowired
    private SchoolService schoolService;

    @ApiOperation(value = "加入学校")
    @GetMapping("/in")
    public void joinIn(@RequestParam String id) {
        schoolService.joinIn(id);
    }

    @ApiOperation(value = "退出学校")
    @GetMapping("/out")
    public void out(@RequestParam String id) {
        schoolService.out(id);
    }

    @ApiOperation(value = "根据学校名分页查询")
    @GetMapping("/page-query")
    public PageResult<SchoolListVO> pageQueryByTitle(SchoolQueryDTO schoolQueryDTO) {
        return schoolService.pageQuery(schoolQueryDTO);
    }

}

